package com.gdssoft.pdaweb.model.am;

/*s
 *  捷达世软件（深圳）有限公司 
 *  Copyright (C) 2008-2010 ShenZhen JieDaShi Software Limited Company.
 */
import java.util.Date;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.google.gson.annotations.Expose;

/**
 * PdaAmMeterList Base Java Bean, base class for the.oa.model, mapped directly
 * to database table
 * 
 * Avoid changing this file if not necessary, will be overwritten.
 * 
 * 
 */
public class PdaAmMeterList extends com.gdssoft.core.model.BaseModel {

	private static final long serialVersionUID = 1L;
	@Expose
	protected String amId;
	@Expose
	protected Long lastDegree;
	@Expose
	protected Long degree;
	@Expose
	protected String recorderId;
	@Expose
	protected String month;
	@Expose
	protected Date recordtime;
	@Expose
	protected String updataid;
	@Expose
	protected String updatedate;
	@Expose
	protected String remark;
	@Expose
	protected String createddt;
	@Expose
	protected String createdby;
	@Expose
	protected String lasteditdt;
	@Expose
	protected String lasteditby;
	@Expose
	protected Long id;
	@Expose
	protected String status;
	/***
	 * 上月修正量
	 */
	protected Long fixedUsage;
	protected String Comments;

	protected PdaAmMeter pdaAmMeter;
	// protected PdaAmOperate pdaAmOperate;

	protected Integer toCrmFlag;
	

	public Long getUsage() {
		long fix = getFixedUsage() != null ? getFixedUsage() : 0;
		long last = getLastDegree() == -1 ? 0 : getFixedUsage();
		return degree - last + fix;
	}
	/*
	public void setUsage(Long usage) {
		this.usage = usage;
	}
	*/

	/**
	 * Default Empty Constructor for class PdaAmMeterList
	 */
	public PdaAmMeterList() {
		super();
	}

	/**
	 * Default Key Fields Constructor for class PdaAmMeterList
	 */
	public PdaAmMeterList(Long in_id) {
		this.setId(in_id);
	}

	/**
	 * * @return String
	 * 
	 * @hibernate.property column="METER_ID" type="java.lang.String" length="13"
	 *                     not-null="true" unique="false"
	 */
	public String getAmId() {
		return this.amId;
	}

	/**
	 * Set the amId
	 * 
	 * @spring.validator type="required"
	 */
	public void setAmId(String aValue) {
		this.amId = aValue;
	}

	/**
	 * * @return Long
	 * 
	 * @hibernate.property column="DEGREE" type="java.lang.Long" length="22"
	 *                     not-null="true" unique="false"
	 */
	public Long getDegree() {
		return this.degree;
	}

	/**
	 * Set the degree
	 * 
	 * @spring.validator type="required"
	 */
	public void setDegree(Long aValue) {
		this.degree = aValue;
	}

	/**
	 * * @return String
	 * 
	 * @hibernate.property column="RECORDER_ID" type="java.lang.String"
	 *                     length="10" not-null="true" unique="false"
	 */
	public String getRecorderId() {
		return this.recorderId;
	}

	/**
	 * Set the recorderId
	 * 
	 * @spring.validator type="required"
	 */
	public void setRecorderId(String aValue) {
		this.recorderId = aValue;
	}

	/**
	 * * @return String
	 * 
	 * @hibernate.property column="MONTH" type="java.lang.String" length="7"
	 *                     not-null="true" unique="false"
	 */
	public String getMonth() {
		return this.month;
	}

	/**
	 * Set the month
	 * 
	 * @spring.validator type="required"
	 */
	public void setMonth(String aValue) {
		this.month = aValue;
	}

	/**
	 * * @return String
	 * 
	 * @hibernate.property column="RECORDTIME" type="java.lang.String"
	 *                     length="50" not-null="true" unique="false"
	 */
	
	/**
	 * * @return String
	 * 
	 * @hibernate.property column="UPDATAID" type="java.lang.String" length="10"
	 *                     not-null="false" unique="false"
	 */
	public String getUpdataid() {
		return this.updataid;
	}

	public Date getRecordtime() {
		return recordtime;
	}

	public void setRecordtime(Date recordtime) {
		this.recordtime = recordtime;
	}

	/**
	 * Set the updataid
	 */
	public void setUpdataid(String aValue) {
		this.updataid = aValue;
	}

	/**
	 * * @return String
	 * 
	 * @hibernate.property column="UPDATEDATE" type="java.lang.String"
	 *                     length="50" not-null="false" unique="false"
	 */
	public String getUpdatedate() {
		return this.updatedate;
	}

	/**
	 * Set the updatedate
	 */
	public void setUpdatedate(String aValue) {
		this.updatedate = aValue;
	}

	/**
	 * * @return String
	 * 
	 * @hibernate.property column="REMARK" type="java.lang.String" length="50"
	 *                     not-null="false" unique="false"
	 */
	public String getRemark() {
		return this.remark;
	}

	/**
	 * Set the remark
	 */
	public void setRemark(String aValue) {
		this.remark = aValue;
	}

	/**
	 * * @return String
	 * 
	 * @hibernate.property column="CREATEDDT" type="java.lang.String"
	 *                     length="50" not-null="false" unique="false"
	 */
	public String getCreateddt() {
		return this.createddt;
	}

	/**
	 * Set the createddt
	 */
	public void setCreateddt(String aValue) {
		this.createddt = aValue;
	}

	/**
	 * * @return String
	 * 
	 * @hibernate.property column="CREATEDBY" type="java.lang.String"
	 *                     length="20" not-null="false" unique="false"
	 */
	public String getCreatedby() {
		return this.createdby;
	}

	/**
	 * Set the createdby
	 */
	public void setCreatedby(String aValue) {
		this.createdby = aValue;
	}

	/**
	 * * @return String
	 * 
	 * @hibernate.property column="LASTEDITDT" type="java.lang.String"
	 *                     length="50" not-null="false" unique="false"
	 */
	public String getLasteditdt() {
		return this.lasteditdt;
	}

	/**
	 * Set the lasteditdt
	 */
	public void setLasteditdt(String aValue) {
		this.lasteditdt = aValue;
	}

	/**
	 * * @return String
	 * 
	 * @hibernate.property column="LASTEDITBY" type="java.lang.String"
	 *                     length="20" not-null="false" unique="false"
	 */
	public String getLasteditby() {
		return this.lasteditby;
	}

	/**
	 * Set the lasteditby
	 */
	public void setLasteditby(String aValue) {
		this.lasteditby = aValue;
	}

	/**
	 * * @return Long
	 * 
	 * @hibernate.id column="ID" type="java.lang.Long" generator-class="native"
	 */
	public Long getId() {
		return this.id;
	}

	/**
	 * Set the id
	 */
	public void setId(Long aValue) {
		this.id = aValue;
	}

	/**
	 * * @return String
	 * 
	 * @hibernate.property column="IS_NAMOL" type="java.lang.String" length="1"
	 *                     not-null="true" unique="false"
	 */
	public String getStatus() {
		return this.status;
	}

	/**
	 * Set the isNamol
	 * 
	 * @spring.validator type="required"
	 */
	public void setStatus(String aValue) {
		this.status = aValue;
	}

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof PdaAmMeterList)) {
			return false;
		}
		PdaAmMeterList rhs = (PdaAmMeterList) object;
		return new EqualsBuilder().append(this.amId, rhs.amId)
				.append(this.degree, rhs.degree)
				.append(this.recorderId, rhs.recorderId)
				.append(this.month, rhs.month)
				.append(this.recordtime, rhs.recordtime)
				.append(this.updataid, rhs.updataid)
				.append(this.updatedate, rhs.updatedate)
				.append(this.remark, rhs.remark)
				.append(this.createddt, rhs.createddt)
				.append(this.createdby, rhs.createdby)
				.append(this.lasteditdt, rhs.lasteditdt)
				.append(this.lasteditby, rhs.lasteditby)
				.append(this.id, rhs.id).append(this.status, rhs.status)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973).append(this.amId)
				.append(this.degree).append(this.recorderId).append(this.month)
				.append(this.recordtime).append(this.updataid)
				.append(this.updatedate).append(this.remark)
				.append(this.createddt).append(this.createdby)
				.append(this.lasteditdt).append(this.lasteditby)
				.append(this.id).append(this.status).toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this).append("amId", this.amId)
				.append("degree", this.degree)
				.append("recorderId", this.recorderId)
				.append("month", this.month)
				.append("recordtime", this.recordtime)
				.append("updataid", this.updataid)
				.append("updatedate", this.updatedate)
				.append("remark", this.remark)
				.append("createddt", this.createddt)
				.append("createdby", this.createdby)
				.append("lasteditdt", this.lasteditdt)
				.append("lasteditby", this.lasteditby).append("id", this.id)
				.append("isNamol", this.status).toString();
	}

	/**
	 * @return the pdaAmMeter
	 */
	public PdaAmMeter getPdaAmMeter() {
		return pdaAmMeter;
	}

	/**
	 * @param pdaAmMeter
	 *            the pdaAmMeter to set
	 */
	public void setPdaAmMeter(PdaAmMeter pdaAmMeter) {
		this.pdaAmMeter = pdaAmMeter;
	}

	/**
	 * @return the lastDegree
	 */
	public Long getLastDegree() {
		return lastDegree;
	}

	/**
	 * @param lastDegree
	 *            the lastDegree to set
	 */
	public void setLastDegree(Long lastDegree) {
		this.lastDegree = lastDegree;
	}

	public Long getFixedUsage() {
		if (null == fixedUsage){
			return 0L;
		}
		else{
			return fixedUsage;
		}
	}

	public void setFixedUsage(Long fixedUsage) {
		
		this.fixedUsage = fixedUsage;
	}

	public String getComments() {
		return Comments;
	}

	public void setComments(String comments) {
		Comments = comments;
	}

	public Integer getToCrmFlag() {
		return toCrmFlag;
	}

	public void setToCrmFlag(Integer toCrmFlag) {
		this.toCrmFlag = toCrmFlag;
	}

}
